<?php
namespace App\Http\Controllers\Reception;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\admin\Netsetting;
use App\admin\Scrollimg;
use App\admin\Logo;
use App\admin\Liuyan;
use App\admin\About;

class LuiyanController extends Controller
{
	public function __construct() {
//		$this->middleware('admindo');
	}
	
	public function index()
	{
		//取网站设置
		$net = new Netsetting;
		$Netsettings = $net::find(1);
		//取滚动图片
		$scrolls = Scrollimg::get();
		//几个LOGO
		$Logos = Logo::get();
		
//		$data = Liuyan::orderBy('id', 'desc')->paginate(15);
		
		$About = About::get();
//		dd($data);
		if(empty($About)){
			return "没有此数据";
		}else{
			return view('reception.luiyan',['about'=>$About,'logo'=>$Logos,'setData'=>$Netsettings,'scrollData'=>$scrolls]);
		}
	}
	
	public function LuiYanUp(Request $request){
		$name = $request->input('name');
		$email = $request->input('email');
		$tel = $request->input('tel');
		$content = $request->input('content');
		
		if($content ==""){
			return "请输入留言内容";
		}
		
		//---------------------------------------
		$Good = new Liuyan;
		$Good->name = $name;
		$Good->info = $content;
		$Good->tel_ = $tel;
		$Good->email_ = $email;
		if($Good->save()){
			return redirect('Luiyan');
		}
	}
}
